<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<?php
require("conn.php");


session_start();
if(isset($_POST['id']))
{
	if($_POST['id']=='')
	{
		$_SESSION['s_pro']=$_SESSION['s_pro'];
	}
	else
	{
		 $id = $_POST['id'];
		if(isset($_SESSION['s_pro'][$id]))
		{
			$_SESSION['s_pro'][$id] = array('id'=>$id,'sl'=>$_SESSION['s_pro'][$id]['sl']+1);
		}
		else
		{
		
				$id = $_POST['id'];
				$_SESSION['s_pro'][$id] = array('id'=>$id,'sl'=>1);
		}
	}	
}
?>
<style type="text/css">
<!--
.style4 {color: #0000FF; font-weight: bold; }
.style5 {
	font-size: 18px;
	font-weight: bold;
	color: #0000FF;
}
.style6 {color: #0000FF; font-weight: bold; font-size: 17px; }
-->
</style>
</head>

<body>
<table width="200" border="0">
  <tr onclick="ahgiohang()">
    <td height="22"><div align="left"><span class="style5">Gio hang cua ban </span></div>
    <div align="center"></div>      <div align="center"></div></td>
  </tr>
  <tr>
    <td>
		<?php
		$a=$_SESSION['s_pro'];
	if(count($a)!=0)
{
	?>
	<table width="594" height="187" border="0" cellpadding="2" cellspacing="2">
      <tr>
        <td width="43" bgcolor="#FF00FF"><span class="style4">Stt</span></td>
        <td colspan="3" bgcolor="#FF00FF"><span class="style4">San pham </span></td>
        <td width="92" bgcolor="#FF00FF"><span class="style4">Don gia </span></td>
        <td width="76" bgcolor="#FF00FF"><span class="style4">So luong </span></td>
        <td width="102" bgcolor="#FF00FF"><span class="style4">Thanh tien </span></td>
        <td width="27" bgcolor="#FF00FF"><span class="style4">Xoa</span></td>
      </tr>
      <?php 
$tt=0;
$tongtien=0;
foreach($a as $k => $v)
	{
	
	
	$sql="SELECT * FROM sanpham where ma='$v[id]'";
	$bang=mysql_query($sql);
	if($row=mysql_fetch_array($bang))
	{
	
	
$tt++;
	?>
      <tr>
        <td colspan="2" bgcolor="#FFFFFF"><?php echo $tt; ?></td>
        <td colspan="2" bgcolor="#FFFFFF"><div align="left"><?php echo $row["ten"]; ?></div></td>
        <td bgcolor="#FFFFFF"><?php echo $row["dongia"]." USD"; ?></td>
        <td bgcolor="#FFFFFF"><?php echo $v['sl']; ?></td>
        <td bgcolor="#FFFFFF"><?php echo ($v['sl']*$row["dongia"]." (<b>USD</b>)"); ?></td>
        <td bgcolor="#FFFFFF"><div align="center"><img class="buy" onclick="xoagiohang(<?php echo($row["ma"]);?>)" name="" src="hinh/delete.gif" width="15" height="15" alt="<?php echo $row["ma"];?>" title="<?php echo $row["ma"];?>"  /></div></td>
      </tr>
      <?php
	$tongtien=$tongtien+($row["dongia"]*$v['sl']);
	}
	}
?>
      <tr>
        <td height="115" colspan="3" valign="top"><form method="post" action="https://www.nganluong.vn/advance_payment.php">
            <div align="center">
              <input type="hidden" name="receiver" value="nguyenvanruol1985@gmail.com" />
              <input type="hidden" name="product" value="Lập trình mã đơn hàng của bạn vào đây" />
              <input type="hidden" name="price" value="<?php echo $tongtien; ?>" />
              <input type="hidden" name="return_url" value="http://complete.com/thank.php" />
              <input type="hidden" name="comments" value="Hãy lập trình ghi chú đơn hàng của bạn vào đây" />
              <div style="border-style:outset;border-width:+2;border-color:#FFCCCC"><input name="image" type="image" src="hinh/nganluong_button.gif" /></div>
            </div>
        </form>          </td>
        <td height="115" colspan="2" valign="top"><div align="center" class="style6" style="border-style:outset;border-width:+2;border-color:#FFCCCC">
          <p>Thanh toan tien mat khi giao hang </p>
          </div></td>
        <font size="+1"><td width="76" valign="middle"><span class="style4">Tong tien thanh toan:</span></td>
        <td colspan="3" valign="middle" ><b style="border-style:inset;border-width:+4;border-color:#4FC9D2"><?php echo ("&nbsp;&nbsp;".$tongtien." (USD) &nbsp; ") ?></b></td>
	    </font>        </tr>
    </table>
	<?php
		}
		else
		{
		echo("Gi&#7887; h&#224;ng cua b&#7841;n hi&#7879;n kh&#244;ng c&#243; m&#7841;c h&#224;ng n&#224;o. H&#227;y ch&#7885;n m&#243;n h&#224;ng m&#224; b&#7841;n mu&#7889;n mua");
		}
	?>	</td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>